package com.adtech.adms.commons.tree;

import java.io.Serializable;
import java.util.List;

import org.apache.struts2.json.annotations.JSON;

import com.adtech.adms.system.pojo.Feature;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;


/**
 * 
 * 
 * @author 门宏建 
 * @since 2011-8-11 
 * 
 * @Copyright (C) AD Tech Workshop All Right Reserved
 */
public class FeatureTreeNode implements TreeNode<Feature> {

	private static final long serialVersionUID = -208974218571096643L;
	private Boolean checked;
	private Boolean halfChecked;
	private Boolean isParent;

	private List<TreeNode<Feature>> nodes;
	private Boolean open;

	// 泛型内的

	public Boolean getChecked() {
		return checked;
	}
	public void setChecked(Boolean checked) {
		this.checked=checked;
	}
	public Boolean getIsParent() {
		return isParent;
	}
	public void setIsParent(Boolean isParent) {
		this.isParent = isParent;
	}
	public String getName() {
		return feature.getName();
	}

	public Boolean getOpen() {
		return open;
	}

	public String getTarget() {
		return feature.getUrlTarget();
	}

	public List<TreeNode<Feature>> getNodes() {
		return nodes;
	}

	public void setNodes(List<TreeNode<Feature>> nodes) {
		this.nodes = nodes;
	}

	@JSON(serialize = false)
	public String getUrl() {
		return feature.getUrl();
	}

	private Feature feature;
	private TreeNode<Feature> parent;

	public FeatureTreeNode(Feature feature) {
		this.feature = feature;
	}

	@JSON(serialize = false)
	@JsonIgnoreProperties
	public Feature getInnerObject() {
		return feature;
	}

	public Serializable getId() {

		return feature.getId();
	}

	public boolean isLeaf() {
		return nodes == null || nodes.size() == 0;
	}
	@JSON(serialize=false)
	@JsonIgnoreProperties
	public TreeNode<Feature> getParent() {
		return parent;
	}

	public void setParent(TreeNode<Feature> parent) {
		this.parent = parent;
	}
	public Boolean getHalfChecked() {
		return halfChecked;
	}
	public void setHalfChecked(Boolean halfChecked) {
		this.halfChecked = halfChecked;
	}
	public String getCode() {
		return feature.getCode();
	}

	
}
